package host.haiwai.mapstruct;

import host.haiwai.entity.Role;
import host.haiwai.vo.RoleVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * Mapstruct 转换pojo转vo工具类
 */
@Mapper
public interface RoleMapstruct {
    RoleMapstruct mapper = Mappers.getMapper(RoleMapstruct.class);

    @Mappings({
            @Mapping(source = "roleId",target = "roleId"),
            @Mapping(source = "roleName",target = "roleName"),
            @Mapping(source = "roleContent",target = "roleContent"),
            @Mapping(source = "enabled",target = "enabled")
    })
    RoleVo rolePojo2Vo(Role role);

    List<RoleVo> roleList2Vo(List<Role> list);
}
